package com.example.schedulemanager.view;

import android.os.Build;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.example.schedulemanager.R;

public class ReminderActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_reminder);

        // Set flags to show on lock screen and turn screen on
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
            setShowWhenLocked(true);
            setTurnScreenOn(true);
        } else {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                    | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
                    | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        }

        String title = getIntent().getStringExtra("schedule_title");
        String description = getIntent().getStringExtra("schedule_description");

        TextView titleTextView = findViewById(R.id.reminderTitleTextView);
        TextView descriptionTextView = findViewById(R.id.reminderDescriptionTextView);
        Button dismissButton = findViewById(R.id.dismissButton);

        titleTextView.setText(title != null ? title : "日程提醒");
        descriptionTextView.setText(description);
        
        dismissButton.setOnClickListener(v -> finish());
    }
} 